unit MainForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
  System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Actions, Vcl.ActnList,
  Vcl.ExtCtrls, Vcl.StdCtrls, dxSkinsCore, dxSkinsdxBarPainter, dxBar, cxClasses,
  cxPC, dxSkinscxPCPainter, dxBarBuiltInMenu, dxTabbedMDI;

type
  TFMainForm = class(TForm)
    ActionList: TActionList;
    ADPanel: TPanel;
    SetFormatAction: TAction;
    SetSelfAction: TAction;
    SetReceiverAction: TAction;
    dxBarManager1: TdxBarManager;
    dxBarManager1Bar1: TdxBar;
    dxBarButton1: TdxBarButton;
    dxBarButton2: TdxBarButton;
    dxBarButton3: TdxBarButton;
    dxTabbedMDIManager1: TdxTabbedMDIManager;
    procedure FormCreate(Sender: TObject);
    procedure SetReceiverActionExecute(Sender: TObject);
    procedure SetSelfActionExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FMainForm: TFMainForm;
  g_syspath, g_datapath, g_dbName: string;

implementation

{$R *.dfm}

uses Connection, qlog, uManageForm;

procedure TFMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
var
  i: Integer;
begin
  for i := 0 to self.MDIChildCount-1 do
  begin
    self.MDIChildren[i].Close;
  end;

end;

procedure TFMainForm.FormCreate(Sender: TObject);
begin
  ConnectionDM := TConnectionDM.Create(Application, g_dbName);

end;

procedure TFMainForm.SetReceiverActionExecute(Sender: TObject);
var
  f: TManageForm;
begin
  f := TManageForm.Create(nil, eReceiver);
  try
    f.Show;
  finally
    //f.Free;
  end;

end;

procedure TFMainForm.SetSelfActionExecute(Sender: TObject);
var
  f: TManageForm;
begin
  f := TManageForm.Create(nil, eSender);
  try
    f.Show;
  finally
    //f.Free;
  end;

end;

Initialization

{$IFDEF DEBUG}
// g_syspath := 'E:\project\delphi\ssxs\trunck\bin\Release\Win32\';
g_syspath := ExtractFilePath(Paramstr(0));
{$ELSE}
  g_syspath := ExtractFilePath(Paramstr(0));
{$ENDIF}
g_datapath := g_syspath { + 'Data\' };

g_dbName := g_datapath + 'db.fdb';

// SetDefaultLogFile(g_syspath + '\log.txt', 1024 * 1024 * 2, False, False);

finalization

end.
